--面板控制器基类
--create by lwt
--date 2018-4-12
require "Common/class"
BaseCtrl = class("BaseCtrl")

function BaseCtrl:InitData(data,layer)
	self.parm = data
	self.layer = layer
	if self.layer == nil then
		self.layer = 1
	end
end

function BaseCtrl:Awake(resName,ctrl)
	self = ctrl
	self.resName = resName
	panelMgr:CreatePanel(resName, self.layer,function (go) self:OnCreate(go) end)
end

function BaseCtrl:OnCreate(go)
	self.luaBehaviour = go:GetComponent('LuaBehaviour')
	self.curPanel:Awake(go)
	self:AddUIEvent()
	self:ShowPanel(self.parm)
	self:InitCtrl()
end

function BaseCtrl:InitCtrl()
	
end

function BaseCtrl:ShowPanel(data)
	look("-----------base showPanel--------------")
	self:AddListener()
	self.curPanel.gameObject:SetActive(true)
end


function BaseCtrl:AddUIEvent()
	look("-----------base-AddUIEvent---------------")
end

function BaseCtrl:AddListener()
	
end

function BaseCtrl:RemoveListener()
	
end

function BaseCtrl:HidePanel()
	self:RemoveListener()
	self.curPanel.gameObject:SetActive(false)
end

function BaseCtrl:ClosePanel()
	self:RemoveListener()
	self.curPanel:DestroyPanel()
	CtrlManager.Close(self.resName)
end